using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text.Json;
using CSharpKit.Extensions;
using CSharpKit.Native.ECCODES;
using Microsoft.VisualStudio.TestTools.UnitTesting;


namespace csk.ntv.grib
{
    [TestClass]
    public class UnitTest_GRIB_01_codes_handle
    {

        [TestMethod]
        public void codes_handle_00()
        {
            Assert.IsTrue(true);
            // --------------------------------------------------------------------------
            var fname = @"E:\sfxData\ECMWF\ERA5\20200802.grib";
            var f = eccodes.codes_fopen(fname);

            var handle = eccodes.codes_handle_new_from_file(IntPtr.Zero, f, ProductKind.GRIB, out int err);
            var errmsg = eccodes.codes_get_error_message(err);
            var c = eccodes.codes_handle_delete(handle);

            var cc = eccodes.codes_fclose(f);
            // --------------------------------------------------------------------------
            Assert.IsTrue(true);
        }

        // {{END}}
    }

}

